<!--
# This file is part of Digidoc
#
# Gemag is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Digidoc Copyright (C) 2008 Paolo Alberti <paolo.alberti_at_gmail.com>
-->

{{extend 'layout.html'}}
{{=t2.include()}}

<script><!--
$(document).ready(function(){
  $("table.sortable tbody tr").mouseover( function() {
     $(this).addClass("highlight"); }).mouseout( function() { 
     $(this).removeClass("highlight"); });
  $('table.sortable tbody tr:odd').addClass('odd');
  $('table.sortable tbody tr:even').addClass('even');

});
//--></script>


<div class="frame">
    <h1>Articoli in giacenza presso il magazzino</h1>
    <br><br>
    {{=form}}
    <table class="sortable">
        <thead>
        <tr>
            <td>Id</td>
            <td>Categoria</td>
            <td>Nuc</td>
            <td>Descrizione</td>
            <td>Matricola</td>
            <td>Quantità</td>
        </tr>
        </thead>
        <tfoot>
            {{for x in recsum:}}
            <tr>
                <td>&nbsp</td>
                <td>&nbsp</td>
                <td>&nbsp</td>
                <td>&nbsp</td>
                <td>&nbsp</td>
                <td>Tot. articoli</td>
                {{tot=x._extra[str(gemag.articoli.quantita.sum())]}}
                {{if tot==None: tot="-----"}}
                <td style="text-align:center">{{=tot}}</td>
            </tr>
            {{pass}}
        </tfoot>
        {{for articolo in records:}}
        <tr>
            <td>{{=articolo.id}}</td>
            <td>{{=articolo.categoria}}</td>
            <td>{{=articolo.nuc}}</td>
            <td>{{=articolo.descrizione}}</td>
            <td>{{=articolo.matricola}}</td>
            <td style="text-align:center">{{=articolo.quantita}}</td>
            <td>{{=A(IMG(_src=URL(r=request,c='static',f='zoom.png')),_href=URL(r=request,f='specifiche_articolo/%s'%articolo.id))}}</td>
            <td>{{=A(IMG(_src=URL(r=request,c='static',f='table_edit.png')),_href=URL(r=request,f='update/%s'%articolo.id))}}</td>
        </tr>
        {{pass}}
    </table>
</div>
